<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>纯路人博客</title>
    <link rel="icon" th:href="@{/source/favicon.ico}" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="纯路人博客">
    <meta name="description" content="纯路人博客">
    <meta name="author" content="纯路人">
    <link th:href="@{/source/css/bootstrap.min.css}" href="/css/bootstrap.min.css" rel="stylesheet">
    <link th:href="@{/source/css/materialdesignicons.min.css}" href="/css/materialdesignicons.min.css" rel="stylesheet">
    <link th:href="@{/source/css/style.min.css}" href="/css/style.min.css" rel="stylesheet">
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">

            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a th:href="@{/index}" href="index.html"><img th:src="@{/source/img/logo-sidebar.png}"
                                                              src="images/logo-sidebar.png"
                                                              title="Kun" alt="Kun"/></a>
            </div>
            <div class="lyear-layout-sidebar-scroll">

                <nav class="sidebar-main">
                    <ul class="nav nav-drawer">

                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"> 文章管理</a>
                            <ul class="nav nav-subnav">
                                <li><a th:href="@{/articleList}"
                                       href="lyear_pages_gallery.html">所有文章</a></li>
                                <li><a th:href="@{/backstage}" href="lyear_pages_gallery.html">我的文章</a></li>
                                <li><a th:href="@{/add_article}" href="lyear_pages_add_doc.html">新增文章</a></li>
                            </ul>
                        </li>

                        <li sec:authorize="hasRole('0')" class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"> 文章审核</a>
                            <ul class="nav nav-subnav">
                                <li><a th:href="@{/review}" href="lyear_pages_gallery.html">待审文章</a></li>
                                <li><a th:href="@{/approved}" href="lyear_pages_gallery.html">通过文章</a></li>
                                <li><a th:href="@{/failed}" href="lyear_pages_add_doc.html">不通过文章</a></li>
                            </ul>
                        </li>

                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"> 评论管理</a>
                            <ul class="nav nav-subnav">
                                <li><a th:href="@{/commentList}" href="lyear_pages_doc.html">我的评论</a></li>
                                <li sec:authorize="hasRole('0')"><a th:href="@{/commentListAll}"
                                                                    href="lyear_pages_doc.html">全部评论</a></li>
                            </ul>
                        </li>

                        <li sec:authorize="hasRole('0')" class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"> 分类管理</a>
                            <ul class="nav nav-subnav">
                                <li><a th:href="@{/typeList}" href="lyear_pages_doc.html">分类列表</a></li>
                                <li><a th:href="@{/add_type}" href="lyear_pages_doc.html">新增分类</a></li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> 博客后台 </span>
                    </div>
                </div>

                <h1><span sec:authorize="hasRole('0')">[管理员]</span><span
                        sec:authentication="principal.username"></span>的博客</h1>
                <a th:href="@{/user/logout}" href="#"> 退出登录</a>
            </nav>

        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table table-bordered">
                                        <thead>
                                        <tr>
                                            <th>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input type="checkbox" id="check-all"><span></span>
                                                </label>
                                            </th>
                                            <th>编号</th>
                                            <th>标题</th>
                                            <th>类型</th>
                                            <th>上传时间</th>
                                            <th>用户</th>
                                            <th>浏览数</th>
                                            <th sec:authorize="hasRole('0')">状态</th>
                                            <th>详情</th>
                                            <th sec:authorize="hasRole('0')">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr th:each="accountAndArticleCnds,item:${accountAndArticleCnds}">
                                            <td>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input type="checkbox" name="ids[]" value="1"><span></span>
                                                </label>
                                            </td>
                                            <td th:text="${item.count}"></td>
                                            <td th:text="${accountAndArticleCnds.getArticle_title()}"></td>
                                            <td th:text="${accountAndArticleCnds.getType_name()}"></td>
                                            <td th:text="${accountAndArticleCnds.getUpload_time()}"></td>
                                            <td th:text="${accountAndArticleCnds.getAccount()}"></td>
                                            <td th:text="${accountAndArticleCnds.getArticle_likes()}"></td>
                                            <td sec:authorize="hasRole('0')"
                                                th:text="${accountAndArticleCnds.getState()} == '0' ? '待审核' : (${accountAndArticleCnds.getState()} == '1' ? '通过' : '不通过') ">
                                                <font class="text-success"></font>
                                            </td>

                                            <td>
                                                <div class="btn-group">
                                                    <a class="btn btn-xs btn-default"
                                                       th:href="@{/articleDetails(article_id=${accountAndArticleCnds.getArticle_id()})}"
                                                       title="详情"
                                                       data-toggle="tooltip">详情</a>
                                                </div>
                                            </td>

                                            <td sec:authorize="hasRole('0')">
                                                <div class="btn-group">
                                                    <a class="btn btn-xs btn-default"
                                                       th:href="@{/deleteArticle(article_id=${accountAndArticleCnds.getArticle_id()})}"
                                                       title="操作"
                                                       data-toggle="tooltip">删除</a>
                                                </div>

                                                <div class="btn-group">
                                                    <a class="btn btn-xs btn-default"
                                                       th:href="@{/updateArticle(article_id=${accountAndArticleCnds.getArticle_id()})}"
                                                       title="修改"
                                                       data-toggle="tooltip">修改</a>
                                                </div>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <ul class="pagination">
                                    <li class="active"><span>1</span></li>
                                    <li><a href="#1">2</a></li>
                                </ul>

                            </div>
                        </div>
                    </div>

                </div>

            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>

<script type="text/javascript" th:src="@{/source/js/jquery.min.js}" src="js/jquery.min.js"></script>
<script type="text/javascript" th:src="@{/source/js/bootstrap.min.js}" src="js/bootstrap.min.js"></script>
<script type="text/javascript" th:src="@{/source/js/perfect-scrollbar.min.js}"
        src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" th:src="@{/source/js/main.min.js}" src="js/main.min.js"></script>
<script type="text/javascript">
    $(function () {
        $('.search-bar .dropdown-menu a').click(function () {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
    });
</script>
</body>
</html>